<!DOCTYPE html>
<html lang="en" style="height:100%">

<head>
	<meta charset="UTF-8">
	<meta name="viewport"
		  content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	<title>主页</title>
	<link rel="stylesheet" type="text/css" href="../../css/api.css" />
	<link rel="stylesheet" type="text/css" href="../../css/style.css" />
	<link rel="stylesheet" type="text/css" href="../../css/yzl.css" />
	<!-- <link rel="stylesheet" href="../../css/sqc.css"> -->
	<style>
		*{
			margin: 0;
			padding: 0;
		}
		input{
			outline:none;
		}

	</style>
</head>

<body style="background: #f7f4f2;">
<div id="app"  v-cloak>
	<div style="background-color: #fff;">
		<div class="personal" style="padding-top: 12px;">
			<div class="portrait">
				<img :src="user.memberAdd?user.memberAdd:'../../image/portrait_moren.png'" />
			</div>
			<div class="item-name">
				<span class="personal-name" v-myclick="login">{{user.nickname?user.nickname:'点击登录'}}</span>
				<div class="redman"></div>
				<div class="item-title" v-myclick="namezhen">{{user.isCertif==2?'已实名':'未实名'}}</div>
				<div class="item-title" v-myclick="edit" style="color: #333333;border: 1px solid #333333;margin-left:12px;">编辑资料</div>
			</div>
			<div class="item-arrow"  v-myclick="[user.isCertif,openmy]">
				<span style="vertical-align: middle; font-size: 15px; color: #999;">主页</span>
				<img style="width: 8.5px;height: 16px;vertical-align: middle" src="../../image/small/arrow_right_grey.png" />
			</div>
			<div class="particulars">
				<span class="particulars-line"></span>
				<span>等级:&nbsp; <span style="color:#F95656;">lv{{user.empiricalLevel?user.empiricalLevel:0}}</span></span>
				<span class="particulars-line"></span>
				<span>达人:&nbsp;<span style="color:#F95656;">lv{{user.darenLevel?user.darenLevel:0}}</span></span>
				<span class="particulars-line"></span>
			</div>
		</div>
		<div class="character-number">
			<div class="character-number-one" style="margin:20px 0 10px 0;font-weight: bold;font-family: BarlowCondensed-Bold;">
				<div class="character-number-title" v-myclick="to_empiricalvalue">{{(user.empiricalValue?user.empiricalValue:0).toFixed(2)}}</div>
				<div class="character-number-title" v-open-win vurl="myassets">{{(user.masonry?user.masonry:0).toFixed(2)}}</div>
				<div class="character-number-title" v-open-win vurl="activitylevel">{{(user.activeValue?user.activeValue:0).toFixed(2)}}</div>
			</div>
			<div class="character-number-one" style="font-size:12px;color:#999;">
				<div class="character-number-title" v-myclick="to_empiricalvalue">经验值</div>
				<div class="character-number-title" v-open-win vurl="myassets">钻石(QHR)</div>
				<div class="character-number-title" v-open-win vurl="activitylevel">活跃度</div>
			</div>
		</div>
		<div class="other-contents">
			<div class="other-contents-one" style="margin-right:1px;" v-myclick="to_QHRorder" v-row-active.tapmode>
				<img v-src="'../../image/order-1.png'"/>
				<span>QHR订单</span>
			</div>
			<div class="other-contents-one" style="margin-right:1px;" v-myclick="to_dealnotice" v-row-active.tapmode>
				<img v-src="'../../image/notice-1.png'"/>
				<span>交易通知</span>
			</div>
			<div class="other-contents-one" style="margin-right:0px;"  v-open-win vurl="myassets" v-row-active.tapmode>
				<img src="../../image/small/2-zichuan.png" />
				<span>我的资产</span>
			</div>
			<div class="other-contents-one" style="margin-right:1px;margin-top:1px;" v-myclick="to_goodfriend">
				<img src="../../image/small/6-haoyou.png" />
				<span>我的好友</span>
			</div>
			<div class="other-contents-one" style="margin-right:1px;margin-top:1px;" v-myclick="to_share">
				<img src="../../image/small/3-yaoqing.png" />
				<span>邀请分享</span>
			</div>
			<div class="other-contents-one" style="margin-right:0px; margin-top:1px;" v-myclick="to_helpcenter">
				<img src="../../image/small/1-bangzhu.png" />
				<span>帮助中心</span>
			</div>

		</div>
	</div>
</div>
</body>
<script src="../../script/api.js"></script>
<script src="../../script/vue.js"></script>
<script src="../../script/app.js"></script>
<script src="../../script/common.js"></script>
<script src="../../script/url.js"></script>
<script src="../../script/components.js"></script>
<script type="text/javascript" src="../../script/jquery.js"></script>

<script>
	var vm,
			user;
	apiready = function () {
		setBSImg();
		new Vue({
			el: '#blank'
		})
		wx = api.require('wx');

		if(!hasPrefs('token')){
			user = {};
			initApp();
		  api.parseTapmode();
		}else{
			var data = {
				member_id: getPrefs('member_id'),
				token:getPrefs('token'),
				wxOpenId:getPrefs('openid')
			};
			var callback = function (ret) {
					user = ret.content;
					console.log(JSON.stringify(user))
					initApp();
					// api.parseTapmode();
			};

			pinet.post(APIURLP+'/play/user/queryUserInfo', data, callback);
		}
// api.parseTapmode();
		addListeners();
		setUserRefreshHeaderInfo(refresh);
	};

	function initApp() {
		// var isBigImg = Vue.BSImg == 'big';
		vm = new Vue({
			el: '#app',
			data: {
				user:user
			},
			computed: {
			},
			methods: {
				openmy:function(value){
					if(!hasPrefs('token')){
						api.openWin({
							name: 'login',
							url: '../login/login.html',
						});
						return;
					}
					api.openWin({
						name: 'homepage',
						url: './homepage.html',
						pageParam: {
							target_id: getPrefs('member_id'),
							isCertif:value,
						}
					});
				},
				login:function(){
					if(!hasPrefs('token')){
						api.openWin({
								name: 'login',
								url: '../login/login.html',
						});
					}
				},
				blacklists:function(){
					if(!hasPrefs('token')){
						api.openWin({
								name: 'login',
								url: '../login/login.html',
						});
						return;
					}
					api.openWin({
						name: 'blacklist',
						url: './blacklist.html'
					});
				},
				edit:function(){
					if(!hasPrefs('token')){
						api.openWin({
								name: 'login',
								url: '../login/login.html',
						});
						return;
					}
					api.openWin({
						name: 'means',
						url: './means.html'
					});
				},
				namezhen:function(){
					if(!hasPrefs('token')){
						api.openWin({
								name: 'login',
								url: '../login/login.html',
						});
						return;
					}
					if(this.user.isCertif==2){
						api.openWin({
							name: 'myauthentication',
							url: './myauthentication.html'
						});
					}else{
						api.openWin({
							name: 'realname',
							url: './realname.html'
						});
					}

				},
				set:function(){
					api.openWin({
						name: 'setup',
						url: './setup.html'
					});
				},
				deletephone:function(){
					this.phone=''
				},
				forget:function(){
					if(!hasPrefs('token')){
						api.openWin({
								name: 'login',
								url: '../login/login.html',
						});
						return;
					}
					api.openWin({
						name: 'pwdforget',
						url: './pwdforget.html',
						pageParam: {
							name: 'test'
						}
					});

				},
				to_empiricalvalue:function () {
					if(!hasPrefs('token')){
						api.openWin({
							name: 'login',
							url: '../login/login.html',
						});
						return;
					}
					api.openWin({
						name: 'empiricalvalue',
						url: './empiricalvalue.html',
					});
				},
				to_dealnotice:function () {
					api.openWin({
						name: 'dealnotice',
						url: './dealnotice.html',
					});
				},
				to_share:function () {
					if(!hasPrefs('token')){
						api.openWin({
							name: 'login',
							url: '../login/login.html',
						});
						return;
					}
					api.openWin({
						name: 'share',
						url: './share.html',
					});
				},
				to_QHRorder:function () {
					if(!hasPrefs('token')){
						api.openWin({
							name: 'login',
							url: '../login/login.html',
						});
						return;
					}
					api.openWin({
						name: 'QHRorder',
						url: '../transaction/QHRorder.html',
					});
				},
				to_goodfriend:function () {
					if(!hasPrefs('token')){
						api.openWin({
							name: 'login',
							url: '../login/login.html',
						});
						return;
					}
					api.openWin({
						name: 'goodfriend',
						url: './goodfriend.html',
					});
				},
				to_helpcenter:function () {
					if(!hasPrefs('token')){
						api.openWin({
							name: 'login',
							url: '../login/login.html',
						});
						return;
					}
					api.openWin({
						name: 'helpcenter',
						url: './helpcenter.html',
					});
				},


			},
			watch: {

			},
		})
	}

	function refresh() {
	if (getPrefs('token')) {
			var data = {
				member_id: getPrefs('member_id'),
				token:getPrefs('token'),
				wxOpenId:getPrefs('openid')
			};
			var callback = function (ret) {
					vm.user = ret.content;
					api.refreshHeaderLoadDone();
					// api.parseTapmode();
			};

			pinet.post(APIURLP+'/play/user/queryUserInfo', data, callback);
	} else {
			api.refreshHeaderLoadDone();
	}

}

	function addListeners(){
		api.addEventListener({
			name: 'viewappear'
		}, function () {
			refresh();
		});

	}


</script>

</html>
